﻿@model yq.WebModel.File.FileListPage
<div class="listdivSmOut">
    @if (Model.CurrFileList.IsLoad)
    {
        <div style="margin: 0px; margin-bottom: 0px; text-align: left">
            <a href="#" onclick="return RefreshForm('-1');">主目录</a>
            @foreach (var key in Model.CurrFileList.Path.Split(char.Parse("/")))
            {

                if (key.Length != 0 && key != "-1")
                {
                @(">")  <a  href="#"  onclick="return RefreshForm('@key')">@(yq.Model.Logic.FileList.Load(key).Ttile)</a>
                }
            }
        </div>
    }
    @if (Model.List.Count == 0)
    { 
    
        <div class="listdivSm">
            <div class="longtxt" onclick="RefreshForm('@Model.CurrFileList.SuperiorId')">
                空的文件夹</div>
        </div>
    }
    @foreach (var info in Model.List)
    {
       
        <div class="listdivSm">
            <div style="float: left; margin-right: 20px;">
                @if (info.Type == yq.Enums.FileList.Type.File)
                {
                    if (info.IsCheckOut == yq.Enums.BooleanType.Yes)
                    {
                    <img onclick="RefreshForm('@info.FileinfoId')" src='@Url.GetUrlResString("Css/metro/img/BitLocker.png")'  width="50px" height="50px"></img>
                    }
                    else
                    {
                    <img onclick="RefreshForm('@info.FileinfoId')" src='@Url.GetUrlResString("Css/metro/img/Documents.png")'  width="50px" height="50px"></img>
                    }
                }
                else
                { 
                    <img onclick="RefreshForm('@info.FileinfoId')" src='@Url.GetUrlResString("Css/metro/img/Blank Folder.png")'  width="50px" height="50px"></img>
                }
            </div>
            <div>
                <div >
                    @if (info.Type == yq.Enums.FileList.Type.File)
                    {
                        @info.Ttile  
                    }
                    else
                    { 
                        <a href="#" onclick="return RefreshForm('@info.FileinfoId')" class="a-role" >@info.Ttile</a>
                    }
                </div>
                <div>
                    @Html.ActionRoleLink(Model.RoleLinkList["设置"], new { fileinfoId = info.FileinfoId }, new { @class = "a-role", alt = "设置", onclick = "return $.DialogAjax(this)" })
                    @Html.ActionRoleLink(Model.RoleLinkList["删除"], new { fileinfoId = info.FileinfoId }, new { @class = "a-role",alt="确认删除该文件", onclick = "return OnDoDelFlie(this)" })
                    @if (info.Type == yq.Enums.FileList.Type.File)
                    {
                        <span class="divider">|</span>
                        <a class="a-role" href="#">操作</a>
                        if (info.IsCheckOut == yq.Enums.BooleanType.Yes)
                        {
                        <span class="divider">|</span>
                        @Html.ActionRoleLink(Model.RoleLinkList["编辑"], new { }, new { @class = "a-role" })
                        }
                        <span class="divider">|</span>
                        @Html.ActionRoleLink(Model.RoleLinkList["下载"], new { }, new { @class = "a-role" })
                    }
                </div>
            </div>
        </div>
    }
</div>
<script>
function OnDoDelFlie(obj)
{
$.confimSubmit(obj,function (data)
  {
     if(data.Status==1)
     {
       $.tips("操作成功");
       RefreshForm();
     }else
     {
      $.tips("操作失败，文件可能被签出");
     }
  });

  return false;
}

</script>
